package cn.xd.base.persistence.mps.impl;

import cn.hutool.core.util.ObjUtil;
import cn.xd.base.persistence.dos.AdminMenuDO;
import cn.xd.base.persistence.mapper.AdminMenuMapper;
import cn.xd.base.persistence.mps.AdminMenuMpService;
import cn.xd.core.response.ObjectResult;
import cn.xd.core.service.impl.BasicMpServiceImpl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springframework.stereotype.Service;

@Service
public class AdminMenuMpServiceImpl extends BasicMpServiceImpl<AdminMenuMapper, AdminMenuDO> implements AdminMenuMpService {
    @Override
    public ObjectResult<AdminMenuDO> getAdminMenu(String perm, Long neId) {
        return getOneForLimitOneResult(Wrappers.lambdaQuery(AdminMenuDO.class)
                .ne(ObjUtil.isNotNull(neId), AdminMenuDO::getId, neId)
                .eq(AdminMenuDO::getPerms, perm));
    }
}
